package logic

import (
	"context"
	"doctor-system/models/mysql"

	"doctor-system/doctorrpc/doctorrpc"
	"doctor-system/doctorrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ListDoctorLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewListDoctorLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListDoctorLogic {
	return &ListDoctorLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ListDoctorLogic) ListDoctor(in *doctorrpc.ListDoctorRequest) (*doctorrpc.ListDoctorResponse, error) {
	// todo: add your logic here and delete this line
	var doctor []mysql.Doctor
	var doctorList []*doctorrpc.ListDoctor

	for _, m := range doctor {
		list := doctorrpc.ListDoctor{
			Name:            m.Name,
			Image:           m.Image,
			Hospital:        m.Hospital,
			RegisterFee:     float32(m.RegisterFee),
			ConsultationFee: float32(m.ConsultationFee),
			Profile:         m.Profile,
		}
		doctorList = append(doctorList, &list)
	}
	return &doctorrpc.ListDoctorResponse{List: doctorList}, nil
}
